<template>
  <div>
    <el-checkbox-group :value="arr">
      <el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
      <el-checkbox label="地推活动" name="type"></el-checkbox>
      <el-checkbox label="线下主题活动" name="type"></el-checkbox>
      <el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
    </el-checkbox-group>
    <el-button
      @click="
        () => {
          //if (click) {
          //if (typeof click === 'function') {
          //函数调用
          // click();
          //} else {
          //字符串调用
          // eval(click)(1);
          // }
          //}

          $emit('propChange', 'arr', ['地推活动']);
          //$emit('propChange', 'text', 'abc');
          //set Schema to PropEdit
          if (test === 'xyz') {
            $emit('propChange', 'test', 'def');
          } else {
            $emit('propChange', 'test', 'xyz');
          }
        }
      "
      >{{ test }}</el-button
    >
  </div>
</template>
<script>
export default {
  name: "QButton",
  props: {
    text: {
      type: String,
    },
    arr: {
      type: Array,
      default: () => [],
    },
    test: {
      type: String,
    },
    click: {
      type: [String, Function],
      default: () => {},
    },
  },
  methods: {
    eval(...p) {
      console.log(p, "p");
      return new Function("a", p[0]);
    },
  },
};
</script>
